﻿using System;
using System.Windows.Threading;

namespace TeBigCommonUI.Items
{
    /// <summary>
    /// Interaction logic for TimeGauge.xaml
    /// </summary>
    public partial class TimeGauge : SimpleGaugeControl
    {
        private DispatcherTimer timer = new DispatcherTimer();

        public TimeGauge()
        {
            InitializeComponent();

            UpdateTime();
            timer.Tick += new EventHandler(OnTimedEvent);
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Start();
        }

        private void OnTimedEvent(object source, EventArgs e)
        {
            UpdateTime();
        }

        private void UpdateTime()
        {
            time7Segment.Text = string.Format("{0:H:mm:ss}", DateTime.Now);
        }
    }
}